<?php
/* Clase del formulario FrmUsers que permite administrar usuarios de SCI
 */
class FrmUsers{
	private $setter;
	private $dbOperator;
	
	private $easyForm;
	private $easyFormBuscar;
	private $frmTableUsers;
	
	private $divUsersTable;
	
		
	function FrmUsers(){
		$this->setter=new Setter("../../Config");
		$this->dbOperator=new DbOperator();
		$this->dbOperator=new DbOperator($this->setter->getDataBaseHost(),$this->setter->getDataBaseUserName(),$this->setter->getDataBaseName(),$this->setter->getDataBasePassword());
		$this->dbOperator->connect();
		$roles=$this->dbOperator->consult("SELECT nombre FROM roles", "yes");
				
		$this->easyForm=new EasyForm("usersForm", "usersForm","get","../../Events/Admin/EventsFrmUsers.php","Registro de nuevo usuario:","","","","");
		$this->easyForm->addInput(1,"Cedula:","cedula","cedula","","","","","form","","",array());
		$this->easyForm->addInput(1,"Nombre:","nombre","nombre","","","","","form","","",array());
		$this->easyForm->addInput(1,"Apellido:","apellido","apellido","","","","","form");
		$this->easyForm->addInput(1,"Nick:","nick","nick","","","","","form");
		$this->easyForm->addInputPassword(1,"Password:","password","password","","","","","form");
		$this->easyForm->addInputPassword(1,"Confirmar Password:","password2","password2","","","","","form");
		$this->easyForm->addSelectionList(1,"Rol:","rol","rol");
		$this->easyForm->setItem("Rol:",$roles);
		$this->easyForm->addInput(1, "Telefono:","telefono","telefono","","","","","form");
		$this->easyForm->addInput(1, "Dirección:","direccion","direccion","","","","","form");
		$this->easyForm->addInput(1, "Ciudad:","ciudad","ciudad","","","","","form");
		$this->easyForm->addInput(1, "Pais:","pais","pais","","","","","form");
		$this->easyForm->addInput(1, "Email:","email","email","","","","","form");	
		$this->easyForm->addButton(12,"","RegistrarU","RegistrarU","registrarU","registrar","registrar usuario","button","","button","","Registrar usuario","","","0", array("onclick"=>"GETMethodSend('cedula','nombre','apellido','nick','password','password2','rol','telefono','direccion', 'ciudad', 'pais', 'email','RegistrarU','tableUsers','../../Events/Admin/EventsFrmUsers.php')"));		
		
		$this->easyFormBuscar=new EasyForm("usersBuscar","usersBuscar","get","../../Events/Admin/EventsFrmUsers.php","Buscar usuario:","","","");
		$this->easyFormBuscar->addInput(1,"Cédula:","id","id","","","","","form","","",array());
		$this->easyFormBuscar->addButton(1,"","buscarUser","buscarUser","buscarUser","buscar","buscar usuario","button","","button","","buscar usuario","","","0",array("onclick"=>"GETMethodSend('id','buscarUser','tableUsers','../../Events/Admin/EventsFrmUsers.php')"));	
		
		$this->frmTableUsers=new FrmTableUsers();
		
		$this->divUsersTable=new Div("tableUsers","tableUsers","tableDB");
	}
	function show(){
		$this->easyForm->show(3,5);
		$this->easyFormBuscar->show(4,1);
		$this->divUsersTable->start();
			$this->frmTableUsers->show();
		$this->divUsersTable->end();
	}
}
?>
